package cn.tedu.mall.front.controller;

import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.front.service.IFrontSpuDetailService;
import cn.tedu.mall.pojo.product.vo.SpuDetailStandardVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/front/spu/detail")
public class FrontSpuDetailController {

    private final IFrontSpuDetailService frontSpuDetailService;

    @Autowired
    public FrontSpuDetailController(IFrontSpuDetailService frontSpuDetailService) {
        this.frontSpuDetailService = frontSpuDetailService;
    }


    /**
     * 根据spuId查询spuDetail
     */
    @GetMapping("/{spuId}")
    public JsonResult<SpuDetailStandardVO> getSpuDetailStandard(@PathVariable("spuId") Long spuId) {
        SpuDetailStandardVO spuDetailStandardVO = frontSpuDetailService.getSpuDetail(spuId);
        return JsonResult.ok(spuDetailStandardVO);
    }

}
